package com.zhu.storesmanager.models;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * 拜访状态数据项
 */

public class VisitTaskInfo implements Parcelable {
    public String mVisitId;
	public String mStoreId;
    public String mName; //任务门店名字
    public String mAddress; //任务门店地址
    public double mLongitude; //门店经纬度
    public double mLatitude;
    public boolean isVisited; //是否已经拜访
    public long mCheckinTime; //签入时间
    public long mCheckoutTime; //签出时间
    public long mDbId = -1; //数据库主键ID

    @Override
    public int describeContents() {
        // TODO Auto-generated method stub
        return 0;
    }

    @Override
    public void writeToParcel(Parcel arg0, int arg1) {
        // TODO Auto-generated method stub
        arg0.writeString(mVisitId);
    	arg0.writeString(mStoreId);
    	arg0.writeString(mName);
        arg0.writeDouble(mLongitude);
        arg0.writeDouble(mLatitude);
        arg0.writeInt(isVisited ? 1 : 0);
        arg0.writeLong(mCheckinTime);
        arg0.writeLong(mCheckoutTime);
        arg0.writeLong(mDbId);
        arg0.writeString(mAddress);

    }

    public static final Parcelable.Creator<VisitTaskInfo> CREATOR = new Creator<VisitTaskInfo>() {
        @Override
        public VisitTaskInfo createFromParcel(Parcel source) {
            VisitTaskInfo info = new VisitTaskInfo();
            info.mVisitId = source.readString();
            info.mStoreId = source.readString();
            info.mName = source.readString();
            info.mLongitude = source.readDouble();
            info.mLatitude = source.readDouble();
            info.isVisited = source.readInt() == 1 ? true : false;
            info.mCheckinTime = source.readLong();
            info.mCheckoutTime = source.readLong();
            info.mDbId = source.readLong();
            info.mAddress = source.readString();
            return info;
        }

        @Override
        public VisitTaskInfo[] newArray(int arg0) {
            return new VisitTaskInfo[arg0];
        }
    };

}
